#!/usr/bin/env python
#
#       genericdefinitions.py
#
#       Copyright 2008 karthikeyan S.<kaarthikeyapreyan@gmail.com>
#
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.

import wx

from wx.lib.wordwrap import wordwrap

import dnddefinitions

from __init__ import VERSION

class GenericEvents:

    def __init__(self,BaseFrameIns):

        self.Inst=BaseFrameIns
        dnddefinitions.DragandDrop().enablednd(self.Inst)

    def about(self,event):
        """
        About PyTestGenerator
        """
        info = wx.AboutDialogInfo()
        info.Name = "PyTestGenerator"
        info.Version = VERSION
        info.SetIcon(wx.Icon\
            ('/usr/share/icons/pytestsgenerator/PyTestGenerator.png',\
             wx.BITMAP_TYPE_PNG))
        info.SetCopyright('(C) 2008 karthikeyan S.<kaarthikeyapreyan@gmail.com>')
        info.Description = wordwrap("Automated TestCase Generator""\n\
            Designed for Python modules",350, wx.ClientDC(self.Inst))
        info.WebSite = ("http://code.google.com/p/pytestsgenerator/", \
            "PyTestGenerator Home Page")
        info.Developers =["Samuel Vijaykumar <mad.vijay@gmail.com>\nKarthikeyan S. <kaarthikeyapreyan@gmail.com>"]
        info.License = wordwrap("PyTestGenerator is free software;\
        you can redistribute it and/or modify it under the terms of the\
        GNU General Public License as published by the Free Software Foundation;\
        either version 2 of the License, or (at your option) any later version.\n\n\
        PyTestGenerator is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\
        without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\
        See the GNU General Public License for more details.\n\n\
        You should have received a copy of the GNU General Public License along with PyTestsGenerator;\
        if not, write to the Free Software Foundation, Inc.,\
        51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA",\
        300, wx.ClientDC(self.Inst))

        wx.AboutBox(info)

    def togglestatusbar(self,event):
        """
        StatusBar Settings
        """
        if self.Inst.sbar.IsChecked():
            self.Inst.statusbar.Show()
        else:
            self.Inst.statusbar.Hide()

        self.Inst.Update()
        self.Inst.Refresh()

    def toggletoolbar(self,event):
        """
        ToolBar Settings
        """
        if self.Inst.tbar.IsChecked():
            self.Inst.toolbar.Show()
        else:
            self.Inst.toolbar.Hide()

        self.Inst.Update()
        self.Inst.Refresh()

    def onexit(self,event):
        """
        File Menu Event to Exit out of the application
        """
        self.Inst.Close()
